//
//  PersonMenuTableViewCell.m
//  KeHuaAlarm
//
//  Created by Fidetro on 2016/12/6.
//  Copyright © 2016年 DTSTON. All rights reserved.
//

#import "PersonMenuTableViewCell.h"
#import "UIColor+HEX.h"
#import "Masonry.h"
@interface PersonMenuTableViewCell ()

/** 图标 **/
@property(nonatomic,strong) UIImageView *iconImageView;
/** 提示Label **/
@property(nonatomic,strong) UILabel *tipLabel;

@end

@implementation PersonMenuTableViewCell


- (instancetype)initWithSettingDic:(NSDictionary *)dic reuseIdentifier:(NSString *)identifier{
    
    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    if (self) {
        
        [self masLayoutSubviewWithSettingDic:dic];
        
    }
    
    return self;
    
}

- (void)masLayoutSubviewWithSettingDic:(NSDictionary *)dic{
    
    __weak UIView *superView = self;
    self.tipLabel.text = dic[@"title"];
    self.iconImageView.image = [UIImage imageNamed:dic[@"image"]];
    
    [self.tipLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(superView.mas_centerX).multipliedBy(0.7);
        make.centerY.mas_equalTo(superView.mas_centerY);
        
    }];
    [self.iconImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.right.mas_equalTo(self.tipLabel.mas_left).mas_offset(-10);
        make.centerY.mas_equalTo(superView.mas_centerY);
        
    }];
    
}

- (UIImageView *)iconImageView{
    
    if (!_iconImageView) {
        
        __weak UIView *superView = self;
        _iconImageView = [[UIImageView alloc]init];
        [superView addSubview:_iconImageView];
        
    }
    
    return _iconImageView;
    
}
- (UILabel *)tipLabel{
    
    if (!_tipLabel) {
        
        __weak UIView *superView = self;
        _tipLabel = [[UILabel alloc]init];
        [superView addSubview:_tipLabel];
        [_tipLabel setFont:[UIFont systemFontOfSize:15.f]];
        [_tipLabel setTextColor:[UIColor colorWithHexString:@"666666"]];
    }
    
    return _tipLabel;
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
